//牛客 JZ39 数组中出现次数超过一半的数字
//思路：哈希计数

#include <vector>
using namespace std;

class Solution {
public:
    int MoreThanHalfNum_Solution(vector<int>& numbers) {
        // write code here
        vector<int> v(50001, 0);
        for(auto e : numbers)
        {
            v[e]++;
        }

        for(int i = 0; i < v.size(); ++i)
        {
            if(v[i] > numbers.size()/2)
            {
                return i;
            }
        }
        return 0;
    }
};